package com.example.bottomnavigationdemo;

import androidx.lifecycle.ViewModelProviders;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;

import jp.wasabeef.glide.transformations.BlurTransformation;
import jp.wasabeef.glide.transformations.CropCircleTransformation;

public class FourthFragment extends Fragment {

    private FourthViewModel mViewModel;

    private ImageView blurImageView;

    private ImageView avatarImageView;

    public static FourthFragment newInstance() {
        return new FourthFragment();
    }

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
       /* return inflater.inflate(R.layout.fourth_fragment, container, false); */
        View view =  inflater.inflate(R.layout.fourth_fragment, container, false);
        blurImageView = (ImageView) view.findViewById(R.id.h_back);

        avatarImageView = (ImageView) view.findViewById(R.id.h_head);



        //设置背景磨砂效果
        Glide.with(getActivity()).load(R.drawable.touxiang)
                .bitmapTransform(new BlurTransformation(getActivity(), 25), new CenterCrop(getActivity()))
                .into(blurImageView);

        //设置圆形图像
        Glide.with(getActivity()).load(R.drawable.touxiang)
                .bitmapTransform(new CropCircleTransformation(getActivity()))
                .into(avatarImageView);
        return view;




    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        mViewModel = ViewModelProviders.of(this).get(FourthViewModel.class);
        // TODO: Use the ViewModel








    }







}